package com.jxdinfo.hussar.activitidemo.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jxdinfo.hussar.activitidemo.dao.BTrainsetTypeDictDao;
import com.jxdinfo.hussar.activitidemo.dao.TrainArchivesDao;

@Service
public class TrainArchivesServiceimpl implements TrainArchivesService {

	@Autowired
	TrainArchivesDao dao;
	
	@Autowired
	BTrainsetTypeDictDao dictDao;

	@Override
	public Map<String, Object> GetTrainNumById(Map<String, Object> map) {
		String trainNum = "";
		Map<String, Object> reMap = new HashMap<String, Object>();
		Map<String, Object> getMap;
		try {
			getMap = dictDao.getTrainNumById(map);
			if (getMap != null) {
				trainNum = (String) getMap.get("TRAINNUM");
			} else {
				reMap.put("status", "error");
				reMap.put("msg", "获取车节信息失败");
				return reMap;
			}
			if (trainNum != null && !"".equals(trainNum)) {
				reMap.put("trainNum", trainNum);
				reMap.put("status", "success");
				reMap.put("msg", "获取车节数量成功");
			} else {
				reMap.put("status", "error");
				reMap.put("msg", "获取车节信息失败");
				return reMap;
			}
		} catch (Exception e) {
			e.printStackTrace();
			reMap.put("status", "error");
			reMap.put("msg", "获取车节信息失败");
		}
		return reMap;
	}
	public List<Map> getProperty(Map map){
		return dao.getProperty(map);
	}
}
